<?php
class Answer_content_Model extends ORM
{
	protected $table_name = 'answers_content';
	protected $primary_key = 'answers_content_id'; 
	protected $col_answers_id = 'answers_id';
	protected $col_language_id = 'languages_id';
	protected $sorting = array('answers_content_id' => 'desc');
	
	public function get($answers_id='',$language_id='')
	{
		$this->db->select('*');
		$this->db->from($this->table_name);		
		$this->db->orderby($this->primary_key,'desc');
		if($answers_id) $this->db->where($this->col_answers_id,$answers_id);
		if($language_id) $this->db->where($this->col_language_id,$language_id);
		$query = $this->db->get();
		return $query->result_array(false);
		
	}
	
	public function get_answers()
	{
		$this->db->select('*');
		$this->db->from('answers');
		$this->db->join('answers_content','answers.answers_id','answers_content.answers_id');
		$this->db->where('answers_status',1);
		$this->db->orderby('answers_sort_order','desc');	
		$this->db->orderby($this->primary_key,'desc');	
		$query = $this->db->get();
		return $query->result_array(false);
	}
}